<?php require_once '../global.php';

function king_def(){
	global $king;
	$king->access('log');

	$name=$_GET['name'];
	$var=$_GET['var'];
	
	if(!empty($name) || !empty($var)){
		$sqls = ' and '.$name."='".$var."'";
		$urls = 'manage.php?pid=PID&rn=RN&name='.$name.'&var='.$var;
	}else{

		$urls = 'manage.php?pid=PID&rn=RN';
	}
		$numfy=$king->db->getRows_number('%s_log_fuq','kid!=0'.$sqls);	
		$_sql="select kid,rot,ip,url,http,zj,lailu,ndate from %s_log_fuq where kid!=0 ".$sqls." order by ndate desc";
	
		$_cmd=array(
			'delete'=>$king->lang->get('system/common/del'),
		);

	

	$manage ="'<a target=\"_blank\" href=\"'+(K[3])+'\">'+$.kc_icon('h7','".$king->lang->get('system/common/brow')."')+'</a>'";	
	$rot ="'<i><a target=\"_blank\" href=\"manage.php?name=rot&var='+(K[1])+'\">'+(K[1])+'</a></i>'";	
	$ip ="'<i><a target=\"_blank\" href=\"manage.php?name=ip&var='+(K[2])+'\"><font color=\'#000000\'>'+(K[2])+'</font></a></i>'";	
	$http ="'<i><a target=\"_blank\" href=\"manage.php?name=http&var='+(K[4])+'\"><font color=\'#000000\'>'+(K[4])+'</font></a></i>'";		
	
	
	
	$_js=array(
		"\$.kc_list(K[0],K[3],'manage.php?name=url&var='+K[3])",
		$ip,
		$rot,
		$http,
		"'<i>'+K[5]+'</i>'",
		"'<i>'+K[7]+'</i>'",	
				$manage,
	);
	$s=$king->openList($_cmd,'',$_js,$king->db->pagelist($urls,$numfy));


	if(!$res=$king->db->getRows($_sql,1))
		$res=array();


	$s.="ll('".$king->lang->get('log/list/a')."',
		'<i>".$king->lang->get('log/list/s')."</i>',
				'<i>".$king->lang->get('log/list/d')."</i>',
				'<i>".$king->lang->get('log/list/f')."</i>',
				'<i>".$king->lang->get('log/list/g')."</i>',
				'<i>".$king->lang->get('log/list/h')."</i>',
	    '<i>".$king->lang->get('log/list/j')."</i>',1);";


	foreach($res as $rs){
		$s.="ll({$rs['kid']},
			   '".$rs['rot']."',
			    '".$rs['ip']."',
			    '".$rs['url']."',
			    '".$rs['http']."',
				'".$rs['zj']."',
				'".$rs['lailu']."',
							'".date('m-j g:i:s',$rs['ndate'])."',0);";

	}




	$s.=$king->closeList();

	if(!empty($var) && $name="bot"){

	$a=file_get_contents($king->config('siteurl')."/browse/log/index.php?bot=".$var);

	$s= str_replace('<form id="k_form_list"',$a.'<form id="k_form_list"',$s);
	}
	list($left,$right)=inc_menu();

	
			
	$king->skin->output($king->lang->get('log/title/center'),$left, $bs,$s);

}





































/**
菜单调用
*/
function inc_menu(){
	global $king;
	$left=array(

		'3'=>array(
			'href'=>'manage.php',
			'ico'=>'p7',
			'title'=>'日志列表',
			),
					'2'=>array(
			'href'=>'manage.php?name=rot&var=Baidu',
			'ico'=>'p7',
			'title'=>'百度',
			),
		'1'=>array(
			'href'=>'manage.php?name=rot&var=百度图片',
			'ico'=>'p7',
			'title'=>'百度图片',
			),

		'4'=>array(
			'href'=>'manage.php?name=rot&var=Google',
			'ico'=>'p7',
			'title'=>'Google',
			),
		'5'=>array(
			'href'=>'manage.php?name=rot&var=谷歌图片',
			'ico'=>'p7',
			'title'=>'谷歌图片',
			),
	);
		
		

	return array($left,array());
}






?>